<?php

namespace app\api\model;

class ArticleModel extends BaseModel
{

    protected $pk = 'id';
    protected $table = 'hs_article';
    protected static $tableName = 'article';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

    public function getCreateTimeAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
    
    public function getUpdateTimeAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }

    public static function detail($id)
    {
        return self::where('id', $id)->find();
    }

}